﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:vm="clr-namespace:GSF.PhasorProtocols.UI.ViewModels"
        x:Class="GSF.PhasorProtocols.UI.Modal.InputWizardWalkthrough"
        Title="Input Wizard Walkthrough" SizeToContent="Height" MinHeight="325" Width="485"
        ShowInTaskbar="False" ResizeMode="NoResize" Loaded="InputWizardWalkthrough_Loaded"
        mc:Ignorable="d" d:DataContext="{d:DesignInstance {x:Type vm:InputWizardDevices}}" Closed="InputWizardWalkthrough_Closed">

    <!-- This wizard has a lot of TabItems, which represent the pages of the walkthrough.
    The easiest way to navigate is to use the Document Outline view on the left. -->
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid Background="{StaticResource MenuBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TabControl Grid.Row="0" x:Name="TabSwitcher" Background="Transparent">
            <!-- Set up default styles for the components on the pages in the walkthrough -->
            <TabControl.Resources>
                <Style TargetType="{x:Type TabItem}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </Style>

                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="Margin" Value="20,0" />
                    <Setter Property="HorizontalAlignment" Value="Center" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="TextAlignment" Value="Center" />
                    <Setter Property="TextWrapping" Value="Wrap" />
                    <Setter Property="FontSize" Value="14" />
                </Style>

                <Style TargetType="{x:Type Button}">
                    <Setter Property="Cursor" Value="Hand" />
                    <Setter Property="HorizontalAlignment" Value="Center" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="Padding" Value="10,-2" />
                    <EventSetter Event="Click" Handler="TraverseDecisionTree" />
                </Style>
            </TabControl.Resources>

            <!-- Override the template to remove the border around the TabControl -->
            <TabControl.Template>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0"/>
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                            <RowDefinition x:Name="RowDefinition1" Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel x:Name="HeaderPanel" Background="Transparent" Grid.Column="0" IsItemsHost="True" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
                        <Grid x:Name="ContentPanel" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
                            <ContentPresenter x:Name="PART_SelectedContentHost" ContentTemplate="{TemplateBinding SelectedContentTemplate}" Content="{TemplateBinding SelectedContent}" ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" ContentSource="SelectedContent" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="2,2,0,2"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </TabControl.Template>

            <!-- Welcome page -->
            <TabItem Header="Welcome">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock FontWeight="Bold" FontSize="16">
                            Welcome to the Wizard Walkthrough!
                        </TextBlock>
                        
                        <TextBlock Margin="20,20,20,0">
                            This walkthrough will guide you in order to
                            fill in the information required by the wizard.
                        </TextBlock>
                    </StackPanel>

                    <Button Grid.Row="1" Content="OK" Tag="TestedConnectionQuery" />
                </Grid>
            </TabItem>
            
            <!-- Step 1 of the wizard -->

            <TabItem Header="TestedConnectionQuery" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <CheckBox Name="StepOneExpandedCheckBox" IsChecked="{Binding StepOneExpanded}" Visibility="Collapsed" />

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                        Have you tested your device's connection settings using the PMU Connection Tester?
                    </TextBlock>

                    <Button Grid.Row="1" Grid.Column="0" Content="Yes" Tag="ConnectionFileQuery" />
                    <Button Grid.Row="1" Grid.Column="1" Content="No" Tag="RunConnectionTesterQuery" />
                </Grid>
            </TabItem>

            <TabItem Header="RunConnectionTesterQuery" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                        It is recommended that you use the PMU Connection Tester
                        to test your connection before continuing.
                        <LineBreak /><LineBreak />
                        Would you like this wizard to attempt to run the PMU Connection Tester?
                    </TextBlock>

                    <Button Grid.Row="1" Grid.Column="0" Content="Yes" Click="RunConnectionTesterQuery_Yes" />
                    <Button Grid.Row="1" Grid.Column="1" Content="No" Tag="NumberOfChannelsQuery" />
                </Grid>
            </TabItem>

            <TabItem Header="ConnectionTesterPathInput" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="4*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0">
                        <TextBlock>
                            The PMU Connection Tester was not found on your system. If you know
                            where the PMU Connection Tester executable is located, you can specify
                            that location below and the wizard will remember this the next time you
                            set up a device.
                            <LineBreak /><LineBreak />
                            If the PMU Connection Tester is not installed on this system, simply
                            click OK to move on to the next step.
                        </TextBlock>
                        
                        <StackPanel Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBox Name="ConnectionTesterPathTextBox" />
                            <Button Content="Browse..." Click="ConnectionTesterBrowse_Click" />
                        </StackPanel>
                    </StackPanel>
                    
                    <Button Grid.Row="1" Content="OK" Click="RunConnectionTesterQuery_OK" />
                </Grid>
            </TabItem>

            <TabItem Header="ConnectionFileQuery" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                        Do you have a connection file from the PMU Connection Tester?
                    </TextBlock>

                    <Button Grid.Row="1" Grid.Column="0" Content="Yes" Tag="ConnectionFileInput" />
                    <Button Grid.Row="1" Grid.Column="1" Content="No" Tag="NumberOfChannelsQuery" />
                </Grid>
            </TabItem>

            <TabItem Header="ConnectionFileInput" Selector.Selected="ConnectionFileInput_Selected">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock>
                            Please enter the path to the connection file from the PMU Connection Tester.
                        </TextBlock>

                        <StackPanel Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBox x:Name="ConnectionFileTextBox" Text="{Binding ConnectionFileName}" />
                            <Button Content="Browse..." Command="{Binding BrowseConnectionFileCommand}" />
                        </StackPanel>
                    </StackPanel>

                    <Button Grid.Row="1" Content="OK" Tag="RequestConfigurationQuery" />
                </Grid>
            </TabItem>

            <TabItem Header="NumberOfChannelsQuery" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <!-- Many TextBoxes, CheckBoxes, and ComboBoxes are included but hidden through the walkthrough,
                    in order to bind to the properties in the view model and use their values in the code behind -->
                    <TextBox Grid.Row="0" Grid.Column="0" Name="CommandChannelTextBox" Text="{Binding AlternateCommandChannel}" Visibility="Collapsed" />
                    <TextBox Grid.Row="0" Grid.Column="0" Name="DataChannelTextBox" Text="{Binding ConnectionString}" Visibility="Collapsed" />

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                        Does your device have two separate communications channels,
                        one for receiving commands and the other for sending data,
                        or does the device have only one communications channel?
                    </TextBlock>

                    <Button Grid.Row="1" Grid.Column="0" Content="One" Tag="SingleChannelInput" />
                    <Button Grid.Row="1" Grid.Column="1" Content="Two" Tag="DualChannelInput" />
                </Grid>
            </TabItem>

            <TabItem Header="SingleChannelInput" Selector.Selected="ConnectionStringInput_Selected">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0">
                        This walkthrough will now launch the connection builder in a
                        new window to allow you to set up the connection to your device's
                        communications channel.
                        <LineBreak /><LineBreak />
                        Click the Launch button when you are ready.
                    </TextBlock>

                    <Button Grid.Row="1" Content="Launch" Tag="{Binding BuildConnectionStringCommand}" Click="DataChannelBuilder_Launch" />
                </Grid>
            </TabItem>

            <TabItem Header="DualChannelInput" Selector.Selected="ConnectionStringInput_Selected">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="3*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock>
                            This walkthrough will now launch the connection builder in a
                            new window to allow you to set up the communications channels
                            to your device.
                            <LineBreak /><LineBreak />
                            Click the Command Channel and Data Channel buttons to configure each channel.
                        </TextBlock>

                        <Button Margin="0,10,0,0" Content="Command Channel" Command="{Binding BuildAlternateCommandChannelCommand}" />
                        <Button Margin="0,10,0,0" Content="Data Channel" Command="{Binding BuildConnectionStringCommand}" />
                    </StackPanel>

                    <StackPanel Margin="0,20,0,0" Grid.Row="1" VerticalAlignment="Center">
                        <TextBlock>Click the Done button when you are ready to move on.</TextBlock>
                        <Button Margin="0,10,0,0" Content="Done" Click="DualChannelInput_Done" />
                    </StackPanel>
                </Grid>
            </TabItem>

            <TabItem Header="ProtocolInput" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.Resources>
                        <CollectionViewSource Source="{Binding Path=ProtocolLookupList}" x:Key="ProtocolLookupList" />
                    </Grid.Resources>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <!-- Many TextBoxes, CheckBoxes, and ComboBoxes are included but hidden through the walkthrough,
                    in order to bind to the properties in the view model and use their values in the code behind -->
                    <ComboBox Grid.Row="0" Grid.Column="0" Name="ProtocolComboBox" ItemsSource="{Binding Source={StaticResource ProtocolLookupList}}" DisplayMemberPath="Value" Visibility="Collapsed"
                              SelectedItem="{Binding Path=ProtocolID, Mode=TwoWay, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource ProtocolLookupList}}" />

                    <TextBlock Grid.Row="0">What is the synchrophasor protocol used by your device?</TextBlock>

                    <Grid Grid.Row="1" HorizontalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        
                        <Button Margin="10,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="IEEE C37.118" Tag="ProtocolVersionInput" />

                        <Button Margin="10,0" Grid.Row="1" Grid.Column="0" Content="IEC 61850-90-5" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="2" Grid.Column="0" Content="IEEE 1344-1995" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="3" Grid.Column="0" Content="SEL Fast Message" Click="PhasorProtocol_Click" />

                        <Button Margin="10,0" Grid.Row="1" Grid.Column="1" Content="BPA PDCstream" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="2" Grid.Column="1" Content="UTK FNET" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="3" Grid.Column="1" Content="Macrodyne" Click="PhasorProtocol_Click" />
                    </Grid>
                </Grid>
            </TabItem>

            <TabItem Header="ProtocolVersionInput" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0">What version of the IEEE C37.118 protocol are you using?</TextBlock>

                    <Grid Grid.Row="1" HorizontalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Button Margin="10,0" Grid.Row="0" Content="IEEE C37.118.2-2011" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="1" Content="IEEE C37.118-2005" Click="PhasorProtocol_Click" />
                        <Button Margin="10,0" Grid.Row="2" Content="IEEE C37.118 Draft 6" Click="PhasorProtocol_Click" />
                    </Grid>
                </Grid>
            </TabItem>

            <TabItem Header="AccessIDInput" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock>
                            What is the Access ID of your device?<LineBreak />
                            This may also be known as ID Code.
                            <LineBreak /><LineBreak />
                            This field may not be necessary depending on its implementation of the protocol.
                        </TextBlock>

                        <StackPanel Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBlock>Access ID</TextBlock>
                            <TextBox Width="{StaticResource XSmallItemSize}" Text="{Binding AccessID}" />
                        </StackPanel>
                    </StackPanel>

                    <Button Grid.Row="1" Margin="0,10,0,0" Content="OK" Tag="RequestConfigurationQuery" />
                </Grid>
            </TabItem>

            <TabItem Header="INIFileInput" Selector.Selected="ExpandStepOne">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock>
                            BPA PDCstream connections require an INI file that contains
                            additional information about the connection. Please enter the
                            path to the INI file used by your BPA PDCstream connection.
                        </TextBlock>

                        <StackPanel Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBox Text="{Binding IniFileName}" />
                            <Button Command="{Binding BrowseIniFileCommand}" Content="Browse..." />
                        </StackPanel>
                    </StackPanel>

                    <Button Grid.Row="1" Margin="0,10,0,0" Content="OK" Tag="RequestConfigurationQuery" />
                </Grid>
            </TabItem>
            
            <!-- Step 2 of the wizard -->

            <TabItem Header="RequestConfigurationQuery" Selector.Selected="ExpandStepTwo">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    
                    <CheckBox Name="StepTwoExpandedCheckBox" IsChecked="{Binding StepTwoExpanded}" Visibility="Collapsed" />

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                        If your device is currently operational, this wizard can attempt to establish a connection and request its configuration.
                        <LineBreak /><LineBreak />
                        Would you like the wizard to attempt to make this connection?
                    </TextBlock>

                    <Button Grid.Row="1" Grid.Column="0" Margin="0,10,0,0" Content="Yes" Tag="RequestConfigurationInput" />
                    <Button Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Content="No" Tag="ConfigurationFileInput" />
                </Grid>
            </TabItem>

            <TabItem Header="RequestConfigurationInput" Selector.Selected="ExpandStepTwo">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <!-- Many TextBoxes, CheckBoxes, and ComboBoxes are included but hidden through the walkthrough,
                    in order to bind to the properties in the view model and use their values in the code behind -->
                    <CheckBox Grid.Row="0" Visibility="Collapsed" IsChecked="{Binding RequestConfigurationPopupIsOpen}" Checked="HideInputWizardWalkthrough" Unchecked="ShowInputWizardWalkthrough" />
                    <CheckBox Name="RequestConfigurationSuccessCheckBox" Grid.Row="0" Visibility="Collapsed" IsChecked="{Binding Path=RequestConfigurationSuccess, Mode=OneWay}" />

                    <TextBlock Grid.Row="0">
                        Note that for devices which do not support commands, it may take up to 60 seconds to receive their configuration frame. This process can be interrupted.
                        <LineBreak /><LineBreak />
                        Click the button below when you are ready to begin.
                    </TextBlock>

                    <Button Grid.Row="1" Margin="0,10,0,0" Content="Request Configuration" Command="{Binding RequestConfigurationCommand}" />
                </Grid>
            </TabItem>

            <TabItem Header="ConfigurationFileInput" Selector.Selected="ExpandStepTwo">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="6*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock>
                            If you have a configuration file, such as those that can be
                            exported by the PMU Connection Tester, the wizard can use that
                            to import your device's configuration.
                            <LineBreak /><LineBreak />
                            If not, simply click OK to continue the walkthrough. Note that
                            you will have to return to step 2 of the wizard to manually
                            configure your device's configuration.
                        </TextBlock>
                        
                        <StackPanel Margin="0,20" Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBox Text="{Binding ConfigurationFileName}" />
                            <Button Content="Browse..." Command="{Binding BrowseConfigurationFileCommand}" />
                        </StackPanel>
                    </StackPanel>

                    <Button Grid.Row="1" Margin="0,10,0,0" Content="OK" Click="ConfigurationFileInput_OK" />
                </Grid>
            </TabItem>

            <TabItem Header="PDCNameInput" Selector.Selected="ExpandStepTwo">
                <AdornerDecorator>
                    <Grid>
                        <Grid.Resources>
                            <CollectionViewSource Source="{Binding Path=VendorDeviceLookupList}" x:Key="VendorDeviceLookupList"/>
                        </Grid.Resources>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="6*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <!-- Many TextBoxes, CheckBoxes, and ComboBoxes are included but hidden through the walkthrough,
                        in order to bind to the properties in the view model and use their values in the code behind -->
                        <CheckBox Name="ConnectionIsToConcentratorCheckBox" Visibility="Collapsed" IsChecked="{Binding ConnectToConcentrator}" />

                        <StackPanel Grid.Row="0" VerticalAlignment="Center">
                            <TextBlock>
                                The wizard has detected that the device you are connecting to is a PDC.
                                Please enter some information about your PDC.
                            </TextBlock>

                            <Grid Margin="0,20" HorizontalAlignment="Center">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Row="0" Grid.Column="0">PDC Acronym</TextBlock>
                                <TextBox Name="PdcAcronymTextBox" Grid.Row="0" Grid.Column="1" Text="{Binding PdcAcronym, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Width="{StaticResource SmallItemSize}" />

                                <TextBlock Grid.Row="1" Grid.Column="0">PDC Name</TextBlock>
                                <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding PdcName}" />

                                <TextBlock Grid.Row="2" Grid.Column="0">PDC Vendor</TextBlock>
                                <ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding VendorDeviceLookupList}" DisplayMemberPath="Value" SelectedItem="{Binding Path=PdcVendorDeviceID, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource VendorDeviceLookupList}}" />
                            </Grid>
                        </StackPanel>

                        <Button Grid.Row="1" Margin="0,10,0,0" Content="OK" Click="PDCNameInput_OK" />
                    </Grid>
                </AdornerDecorator>
            </TabItem>

            <TabItem Header="HistorianInput" Selector.Selected="ExpandStepTwo">
                <Grid>
                    <Grid.Resources>
                        <CollectionViewSource Source="{Binding HistorianLookupList}" x:Key="HistorianLookupList" />
                        <CollectionViewSource Source="{Binding CompanyLookupList}" x:Key="CompanyLookupList" />
                        <CollectionViewSource Source="{Binding InterconnectionLookupList}" x:Key="InterconnectionLookupList" />
                    </Grid.Resources>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="3*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel VerticalAlignment="Center">
                        <TextBlock>
                            Please enter some additional information about your device,
                            including the historian that you would like to use to archive
                            the data from this device.
                        </TextBlock>
                        
                        <Grid Margin="0,20" HorizontalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            
                            <TextBlock Grid.Row="0" Grid.Column="0">Historian</TextBlock>
                            <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding HistorianLookupList}" DisplayMemberPath="Value" SelectedItem="{Binding Path=HistorianID, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource HistorianLookupList}}" />

                            <TextBlock Grid.Row="1" Grid.Column="0">Company</TextBlock>
                            <ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding CompanyLookupList}" DisplayMemberPath="Value" SelectedItem="{Binding Path=CompanyID, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource CompanyLookupList}}" />

                            <TextBlock Grid.Row="2" Grid.Column="0">Interconnection</TextBlock>
                            <ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding InterconnectionLookupList}" DisplayMemberPath="Value" SelectedItem="{Binding Path=InterconnectionID, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource InterconnectionLookupList}}" />
                        </Grid>
                    </StackPanel>
                    
                    <Button Grid.Row="1" Content="OK" Tag="Farewell" />
                </Grid>
            </TabItem>
            
            <!-- Farewell page -->
            <TabItem Header="Farewell" Selector.Selected="ExpandStepThree">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <CheckBox Name="StepThreeExpandedCheckBox" IsChecked="{Binding StepThreeExpanded}" Visibility="Collapsed" />

                    <StackPanel Grid.Row="0" VerticalAlignment="Center">
                        <TextBlock FontWeight="Bold" FontSize="16">
                            You have reached the end of the walkthrough!
                        </TextBlock>

                        <TextBlock Margin="20,20,20,0">
                            You will now be returned to the wizard to review
                            your device's settings and configuration.
                        </TextBlock>
                    </StackPanel>
                    
                    <Button Grid.Row="1" Content="Finish" Click="FinishWalkthrough_Click" />
                </Grid>
            </TabItem>
        </TabControl>

        <Button Grid.Row="1" HorizontalAlignment="Left" Margin="10" Content="&lt; Back" Click="BackButton_Click" />
        <CheckBox Name="DoNotShowCheckBox" Grid.Row="1" HorizontalAlignment="Right" Margin="10" Content="Do not show automatically" Checked="DoNotShowAtStartup_Checked" Unchecked="DoNotShowAtStartup_Unchecked" />
    </Grid>
</Window>
